#

| Chapter 23 Removing Files |

## 23.5 Remove Some, Leave Some

Most people use rm -i (21.11) for safety: so they're always asked for confirmation before removing a particular file. Mike Loukides told me about another way he uses rm -i. When he has several files to remove, but the wildcards (1.16) would be too painful to type with a plain rm, Mike gives rm -i a bigger list of filenames and answers "n" to filenames he doesn't want deleted. For instance:

>     % ls
>     aberrant    abhorred    abnormal     abominate   acerbic
>     aberrate    abhorrent   abominable   absurd      acrimonious
>         ...
>     % rm -i ab*
>     rm: remove aberrant (y/n)? y
>     rm: remove aberrate (y/n)? n
>     rm: remove abhorred (y/n)? y
>     rm: remove abhorrent (y/n)? n
>         ...

- JP

23.4 Answer "Yes" or "No" Forever with yes |  | 23.6 A Faster Way to Remove Files Interactively